"""
Package defines a FileSystem interface, 
which gives unified access to filesystem-like resources.

This interface is implemented by to classes:

- LocalFS - a directory in local filesystem;
- SacvoyageFS - a filesystem in sacvoyage collection (usually db.files) 



"""



class Reader:
	"""reader stream interface"""
	def read(self, n=-1):
		"""read no more than bytes from stream, -1 means read all data"""
		pass
	def getContentType(self):
		"""get content type of data in stream"""
		pass
	def close(self):
		"""close stream if needed"""
		pass
    
class Writer:
	"""writer stream interface"""
	def write(self, data):
		"""write data to stream"""
		pass
	def setContentType(self, contentType):
		"""set mime/type to written data"""
		pass
	def close(self):
		"""flush all data and close stream"""
	

class FS:
	"""Generic class for file system classes"""
	
	def open(self, fileName, mode='rt'):
		"""return stream to read/write to fileName according to mode"""
		pass
	
	def stamp(self, fileName):
		"""return the stamp of file or None if file not exist"""
		pass
	
	def hash(self, fileName):
		"""return sha1-hash of file"""
		pass
	
	def delete(self, fileName):
		"""delete file"""
		pass
	
	def files(self):
		"""return {fileName: stamp}-dict of all files"""
		pass
	
	def url(self, file):
		pass


	

	

	